home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 3.8 KB | 146 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLMixOS.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef SLMIXCOS_H
- #include "SLMixOS.h"
- #endif
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwtoolbx
- #endif
-
- //========================================================================================
- // Mix OS Utilities
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // ::CenterRectOnScreen
- //----------------------------------------------------------------------------------------
-
- FW_PlatformError SL_API FW_CenterRectOnScreen(FW_SRect& aRect, FW_Boolean horizontally, FW_Boolean vertically, FW_Boolean forDialog)
- {
- // No try block necessary - Do not throw
-
- #ifdef FW_BUILD_MAC
- FW_CPlatformRect srcRect = *(FW_CRect*)&aRect;
-
- short newSize = 0;
- FW_CPlatformPoint rectSize, screenSize;
-
- ::SetPt(&rectSize, srcRect.right - srcRect.left, srcRect.bottom - srcRect.top);
- ::SetPt(&screenSize, FW_QDGlobals.screenBits.bounds.right - FW_QDGlobals.screenBits.bounds.left,
- FW_QDGlobals.screenBits.bounds.bottom - FW_QDGlobals.screenBits.bounds.top);
- screenSize.v -= GetMBarHeight();
-
- // Calculate screen size minus menu bar
- if (horizontally)
- srcRect.left = (screenSize.h - rectSize.h) / 2;
- if (vertically)
- if (forDialog)
- {
- newSize = (screenSize.v - rectSize.v) / 5;
- srcRect.top = (short)(FW_Maximum(newSize, (short) 10) + GetMBarHeight());
- }
- else
- srcRect.top = (screenSize.v - rectSize.v) / 2;
-
- srcRect.bottom = srcRect.top + rectSize.v;
- srcRect.right = srcRect.left + rectSize.h;
-
- *(FW_CRect*)&aRect = srcRect;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_UNUSED(aRect);
- FW_UNUSED(horizontally);
- FW_UNUSED(vertically);
- FW_UNUSED(forDialog);
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
-
- return FW_xNoError;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_GetMainScreenBounds
- //----------------------------------------------------------------------------------------
-
- FW_PlatformError SL_API FW_GetMainScreenBounds(FW_SRect& bounds)
- {
- // No try block necessary - Do not throw
-
- #ifdef FW_BUILD_MAC
- FW_CPlatformRect scr(0,
- LMGetMBarHeight(),
- FW_QDGlobals.screenBits.bounds.right,
- LMGetMBarHeight() + FW_QDGlobals.screenBits.bounds.bottom);
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_CPlatformRect scr;
- ::GetWindowRect(::GetDesktopWindow(), &scr);
- #endif
-
- *(FW_CRect*)&bounds = scr;
-
- return FW_xNoError;
- }
-
- //----------------------------------------------------------------------------------------
- // ::FW_Beep
- //----------------------------------------------------------------------------------------
-
- void SL_API FW_Beep()
- {
- // No try block necessary - Do not throw
-
- #ifdef FW_BUILD_MAC
- ::SysBeep(10);
- #endif
- #ifdef FW_BUILD_WIN
- ::MessageBeep(MB_OK);
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // ::FW_GetTickCount
- //----------------------------------------------------------------------------------------
-
- unsigned long SL_API FW_GetTickCount()
- {
- // No try block necessary - Do not throw
-
- #ifdef FW_BUILD_MAC
- return ::TickCount();
- #endif
- #ifdef FW_BUILD_WIN
- return ::GetTickCount();
- #endif
- }
-
-
-